home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / System / VirusCheckerII / ARexx / virus.rexx < prev    next >
OS/2 REXX Batch file  |  1999-06-12  |  2KB  |  98 lines

  1. /*  Virus checker AREXX script for periodical invocation  */
  2.  
  3. if ~show('l','rexxreqtools.library') then
  4.     call addlib('rexxreqtools.library',0,-30,0)
  5. if ~show('l','rexxsupport.library') then
  6.     call addlib('rexxsupport.library',0,-30,0)
  7.  
  8. NL = '0a'x
  9.  
  10. listing = showdir('Q:',"F")        /* look for files in Q: */
  11. if listing = "" then
  12.     exit                        /* exit if none */
  13. else
  14.  
  15. /* make sure that the dup directory is empty first! */
  16. listing = showdir('DL:dup',"F")
  17. if listing ~= "" then
  18. do
  19.     address command
  20.         'playsound sfx:voice/attention.ssmp quiet'
  21.     call rtezrequest( "      WARNING!" || NL ||,
  22.                       "      ~~~~~~~~" || NL ||,
  23.                       "Dup directory is not" || NL ||,
  24.                       "Empty!  Unable to scan files!", "EXIT")
  25.     exit
  26. end
  27. else
  28.  
  29. call rtezrequest('Scan files now?','Yes|No')
  30. select
  31.     when rtresult=1 then
  32.         signal scan
  33.     otherwise
  34.         exit
  35.  
  36. scan:
  37. /* if ~exists(Virus_Checker) */
  38.     address 'Virus_CheckerII' 'scan dh1:quarantine'
  39.  
  40. /* Q: dir checker to check for*/
  41. /* any virri in the new files */
  42. /* and move them to DL:       */
  43.  
  44. err = 0
  45. r = 0
  46.  
  47. /* command to check directories and compare files */
  48.  
  49. options results
  50.  
  51. address command
  52. 'dh0:progs/ls -mCIf Q: >t:vc1'
  53.  
  54. call open('the_file','t:vc1','R')
  55. do until EOF('the_file')
  56.     j = readln('the_file')
  57.     if j = '' then
  58.         signal done
  59.     else
  60.         /* say "moving file "||j */
  61.         r = exists('dl:'||j)  /* r=1 then we have the file already existing */
  62.         if r = 1 then
  63.         do
  64.             address command
  65.             'move q:'|| j ||' to dl:dup/'||j
  66.             err = err + 1
  67.             ef.err = j
  68.             /*  incriment error counter for later use  */
  69.         end
  70.         else
  71.         do
  72.             /* just move the file normally */
  73.             address command
  74.             'move q:'|| j || ' DL: clone'
  75.             /* say "all ok" */
  76.         end
  77. end
  78. done:
  79. call close('the_file')
  80.  
  81. address command
  82. 'rm t:vc1 quiet'
  83.  
  84. say 'Finished...'
  85. if err ~= 0 then
  86. do
  87. /*    say err || ' file/s already existing.'  */
  88.     address command
  89.         'playsound sfx:voice/attention.ssmp quiet'
  90.     call rtezrequest( "              WARNING!" || NL ||,
  91.                       "              ~~~~~~~~" || NL ||,
  92.                       err || " files were put in the DL:DUP directory" || NL ||,
  93.                       "because there a file of the same name/s already" || NL ||,
  94.                       "exsisted in DL:  Please attend to ASAP!", "EXIT")
  95. end
  96.  
  97. /*  */
  98.